// 服务器全部接口返回的数据类型

export interface ResponeData {
    code: number,
    message: string,
    ok: boolean
}

// SPU数据ts类型
export interface SpuData {
    id?: number,
    spuName: string,
    description: string,
    category3Id: string | number,
    tmId: string,
    spuSaleAttrList: null | SaleAttr[],
    spuImageList: null | SpuImg[]
}

// 数组：元素是已有SPU数据类型
export type Records = SpuData[]

// 定义获取已有的SPU接口返回的数据ts类型
export interface HasSpuResponseData extends ResponeData {
    data: {
        records: Records,
        total: number,
        size: number,
        current: number,
        searchCount: boolean,
        pages: number
    }
}

// 品牌数据的ts类型
export interface Trademark {
    id: number,
    tmName: string,
    logoUrl: string
}

// 品牌接口返回的数据ts类型
export interface AllTradeMark extends ResponeData {
    data: Trademark[]
}

// 商品图片的ts类型
export interface SpuImg {
    id?: number,
    createTime?: string,
    updateTime?: string,
    spuId?: number,
    imgName?: string,
    imgUrl?: string,

    name?: string,
    url?: string
}

// 已有的SPU照片墙数据类型
export interface SpuHasImg extends ResponeData {
    data: SpuImg[]
}

// 已有的销售属性值对象ts类型
export interface SaleAttrValue {
    id?: number,
    createTime?: null,
    updateTime?: null,
    spuId?: number,
    baseSaleAttrId: number | string,
    saleAttrValueName: string,
    saleAttrName?: string
    isChecked?: null
}

// 存储已有的销售属性值的数组类型
export type spuSaleAttrValueList = SaleAttrValue[]

// 销售属性对象ts类型
export interface SaleAttr {
    id?: number,
    createTime?: null,
    updateTime?: null,
    spuId?: number,
    baseSaleAttrId: number | string,
    saleAttrName: string
    spuSaleAttrValueList: spuSaleAttrValueList,
    flag?: boolean,
    saleAttrValue?: string
}

// SPU已有的销售属性接口返回数据ts类型
export interface SaleAttrResponseData extends ResponeData {
    data: SaleAttr[]
}
// 已有的全部SPU的返回数据类型
export interface HasSaleAttr {
    id: number,
    name: string
}

export interface HasSaleAttrResponseData extends ResponeData {
    data: HasSaleAttr[]
}

export interface skuAttr {
    id?: number,
    attrId: string | number,
    valueId: string | number,
    valueName?: string
}

export interface skuSaleAttr {
    id?: number,
    saleAttrId: string | number,
    saleAttrValueId: string | number,
    saleAttrValueName?: string
}

export interface skuImage {
    createTime?: null | string,
    id?: number,
    imgName: string,
    imgUrl: string,
    isDefault: boolean,
    skuId?: number,
    spuImgId?: number,
    updateTime?: null | string,
}

// SKU数据
export interface SkuData {
    category3Id: string | number,
    spuId: string | number,
    tmId: string | number,
    id?: number | string,
    skuName: string,
    isSale?: boolean,
    price: string | number,
    weight: string | number,
    skuDesc: string,
    skuAttrValueList?: skuAttr[],
    skuSaleAttrValueList?: skuSaleAttr[],
    skuImageList?: skuImage[],
    skuDefaultImg: string
}

export interface SkuInfoData extends ResponeData {
    data: SkuData
}